﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace jsGotoDefinition.VS2010.Helpers
{
    /// <summary>
    /// An object representing a regular expression to be used for searching for the definition of a javascript function/method or variable
    /// </summary>
    public class FindRegEx
    {
        /// <summary>
        /// The actual "Find in Files" type regular expression as a global template with a specific word that will be replaced with the function/variable name we are searching for        
        /// i.e. {{.prototype.replacewithfunctionname}[:b]+=} where "replacewithfunctionname" will be replaced with SearchName
        /// </summary>
        public string RegExTemplate { get; set; }

        /// <summary>
        /// The name of the function, method, variable etc that we want to find the definition for
        /// </summary>
        public string SearchName { get; set; }

        /// <summary>
        /// A readonly property defining the regular expression with the SearchName replaced in the regular expression template
        /// i.e. {{.prototype.myfunction}[:b]+=} where "myfunction" is the SearchName
        /// </summary>
        public string SearchRegEx { get { return RegExTemplate.Replace("replacewithfunctionname", SearchName); } }
    }
}
